package com.sy.controller.inventory;

import com.sy.bean.inventory.InOutWarehouse.param.HouseParam;
import com.sy.bean.inventory.InOutWarehouse.param.UpdateHouseParam;
import com.sy.common.bean.ResultBean;
import com.sy.common.controller.BaseController;
import com.sy.common.utils.BeanOfMap;
import com.sy.service.inventory.inOutWarehouse.OutInWarehouseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/outIn")
@Api(tags = "出入库")
public class OutInWarehouseController extends BaseController {
    @Autowired
    OutInWarehouseService outInWarehouseService;

    @ApiOperation("出入库管理列表")
    @PostMapping("/query")
    public ResultBean query(@RequestBody HouseParam param) {
        return success("出入库管理列表", outInWarehouseService.query(BeanOfMap.bom(param)));
    }
    @ApiOperation("出入库表详情")
    @GetMapping("/queryDetail")
    public ResultBean queryDetail(int id) {
        return success("出入库管理列表", outInWarehouseService.queryDetail(id));
    }
    @ApiOperation("确认出库入库")
    @PutMapping("/outHouse")
    public ResultBean outHouse(@RequestBody UpdateHouseParam param) {
        outInWarehouseService.outHouse(param);
        return success("确认出库");
    }
    @ApiOperation("删除出入库单")
    @DeleteMapping("/delete")
    public ResultBean delete(int id) {
        outInWarehouseService.delete(id);
        return success("删除成功");
    }
}
